package object;

import java.util.Vector;

import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.OutputStream;
import java.io.OutputStreamWriter;

/**
 * This class of SpellingTable is to record the relationship between index and IDENTIFIERs
 * We use Vector to record it because the number of IDENTIFIERS can be very large and the Vector is dynamic. So we think Vector is more suitable than normal array in this question
 * @author YaoXiao
 * @version 0.0
 * @date 18/09/2013
 */
public class SpellingTable {
	Vector<String> vectorTable = new Vector<String>();
	public void put(String attributeValue){
		vectorTable.add(attributeValue);
	}
	public void writeToFile(String filename){
		File file = new File(filename);
		try {
			FileWriter fileWriter = new FileWriter(file);			
			for(int i = 0 ; i<vectorTable.size();i++){				
					fileWriter.write(String.valueOf(i)+"\t"+vectorTable.get(i)+"\n");				
			}			
			fileWriter.close();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
	}
}
